const myInstanceof = (left, right) => {
  if(!left && !right) return;
  let proto = Object.getPrototypeOf(left);
  while(proto) {
    if(proto === right.prototype) {
      return true
    }
    proto = Object.getPrototypeOf(proto)
  }
  return false
}

const obj = [];
console.log(myInstanceof(obj, Object));
console.log(myInstanceof(obj, Array));
console.log(myInstanceof(obj, Function));